﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:local="clr-namespace:Brjnk.Common.UI">

        <Style TargetType="{x:Type local:WatermarkedTextBox}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type local:WatermarkedTextBox}">

                        <Grid>
                            <TextBox x:Name="PART_TextBox"
                                 Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"/>
                            <TextBlock x:Name="PART_TextBlock"
                                   Visibility="Hidden"
                                   Text="{TemplateBinding Watermark}"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   Foreground="{TemplateBinding WatermarkForeground}"
                                   IsHitTestVisible="False" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger  SourceName="PART_TextBox" Property="Text" Value="">
                                <Setter TargetName="PART_TextBlock" Property="Visibility" Value="Visible" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

</ResourceDictionary>